<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui/css/H-ui.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/css/H-ui.admin.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/lib/Hui-iconfont/1.0.8/iconfont.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/skin/default/skin.css}" id="skin"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/h-ui.admin/css/style.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/static/lib/laypage/1.2/skin/laypage.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/static/layui/css/layui.css}">
    <script type="text/javascript" th:src="@{/static/lib/jquery/1.9.1/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/layer/2.4/layer.js}"></script>
    <script type="text/javascript" th:src="@{/static/h-ui/js/H-ui.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/h-ui.admin/js/H-ui.admin.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/My97DatePicker/4.8/WdatePicker.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/datatables/1.10.0/jquery.dataTables.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/js/laypage/laypage.js}"></script>
    <script th:src="@{/static/lib/vue.min.js}"></script>

</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    首页 <span class="c-gray en">&gt;</span>
    资讯管理 <span class="c-gray en">&gt;</span>
    资讯列表 <a class="btn btn-success radius r" onclick="openBroadcastEveryAdd()" style="line-height:1.6em;margin-top:3px" title="添加新章节">
                    <i class="Hui-iconfont">&#xe600;</i>
            </a>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <a class="btn btn-success radius r"  style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新">
                <i class="Hui-iconfont">&#xe68f;</i>
            </a>
</nav>
<div class="page-container">
    <div class="text-c">
        <button onclick="removeIframe()" class="btn btn-primary radius">关闭选项卡</button>
        请选择查询条件：
        <select id="query">
            <option value="0">-----请选择-----</option>
            <option value="yes">通过</option>
            <option value="refuse">拒绝</option>
            <option value="no">未审核</option>
        </select>
        <button id="aa" class="btn btn-success"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
    </div>
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="r">共有数据：<strong id="countCol"></strong> 条</span></div>
    <div class="mt-20" id="list">
        <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
            <thead>
            <tr class="text-c">
                <th width="80">编号</th>
                <th width="120">课节标题</th>
                <th width="120">所属课程</th>
                <th width="80">发布时间</th>
                <th width="80">发布人</th>
                <th width="80">直播开始时间</th>
                <th width="80">直播结束时间</th>
                <th width="80">状态</th>
                <th width="120">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr class="text-c" v-for="(item,index) in result">
                <td>{{index+1}}</td>
                <!--<input type="hidden" :value="item.course.courseId" id="courseId">-->
                <td id="lessionTitle">{{item.lessionBroadcastTitle}}</td>
                <td>{{item.broadcast.broadcastTitle}}</td>
                <td>{{item.lessionBroadcastTime}}</td>
                <td>{{item.broadcast.teacher.teacherName}}</td>
                <td>{{item.broadcast.broadcastBegtime}}</td>
                <td>{{item.broadcast.broadcastEndtime}}</td>
                <td>{{item.lessionBroadcastVideo}}</td>
                <td class="f-14 td-manage">
                    <a style="text-decoration:none" class="ml-5" @click="del(this,item.lessionBroadcastId)" title="删除">
                        <i class="Hui-iconfont">&#xe6e2;</i>
                    </a>
                    <a  style="text-decoration:none"  v-if="item.lessionBroadcastVideo === '未上传'" @click="upload                                                                                                            (item.lessionBroadcastId)" class="ml-5" title="上传本章录播">
                          <i class="Hui-iconfont">&#xe642;</i>
                    </a>
                    <a style="text-decoration:none" @click="preview(item.lessionBroadcastId)" class="ml-5" title="视频预览">
                        <i class="Hui-iconfont">&#xe6e6;</i>
                    </a>
                </td>
            </tr>
            </tbody>
        </table><br/>
        <div id="pagenav"></div>
    </div>
</div>

</body>
<script type="text/javascript" th:src="@{/static/layui/layui.js}"></script>
<script th:inline="javascript">


    /*弹窗添加*/
    function openBroadcastEveryAdd() {
        layer.open({
            type: 2,
            title: false,
            offset: '70px',
            closeBtn: false,
            skin: 'yourclass',
            // fix: false,
            // maxmin: true,
            shadeClose: true,
            area: ['401px', '380px'],
            content: '/broadcast/toTeacherBroadcastEveryAdd?broadcastId='+[[${broadcastId}]],
            end: function () {
                shuaxin();
                getS();
            }
        });
    }

    var app = new Vue({
        el: '#list',
        data: {
            result: []
        }
    });
    /*分页获取所有该直播的所有章节*/
    var getAllLession = function (curr) {
        $.ajax({
            type: 'post',
            dataType: 'json',
            url: '/broadcast/getBroadcastLessionById',
            data: {
                broadcastId:[[${broadcastId}]],
            },
            success: function (data) {
                $.each(data,function (i,item) {
                    if(item.lessionBroadcastVideo == undefined){
                        item.lessionBroadcastVideo = '未上传'
                    }else {
                        item.lessionBroadcastVideo = '已上传'
                    }
                })
                console.log(data)
                app.result = data;
            }
        })
    };
    getAllLession();

    /*删除*/
    function del(obj,id) {
        $.ajax({
            type: 'post',
            dataType: 'json',
            url: '/broadcast/delBroadcastLessionById',
            data: {
                lessionBroadcastId:id,
            },
            success: function (data) {
                if (data[0] == "succ"){
                    window.location.reload();
                }
            }
        })
    }

    /*上传*/
    function upload(id) {
        layer.open({
            type: 2,
            title: false,
            offset: '70px',
            closeBtn: false,
            skin: 'yourclass',
            // fix: false,
            // maxmin: true,
            shadeClose: true,
            area: ['800px', '600px'],
            content: '/broadcast/toTeacherBroadcastEveryFileAdd?lessionBroadcastId='+id,
            end: function () {
                shuaxin();
                getS();
            }
        });
    }
    /*预览*/
    function preview(id) {
        $.ajax({
            type: 'post',
            dataType: 'json',
            url: '/lessionBroadcast/getVideo',
            data: {
                lessionBroadcastId:id,
            },
            complete:function(){
                location.href ="/lessionBroadcast/getVideo?lessionBroadcastId="+id
            }//跳转页面
        })
    }



</script>
</html>
